﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once
#include "GcmpActionInterface.h"
#include "WeakReferenceable.h"
#include <vector>
#include <string>

namespace gcmp
{
    class IActionInputEvent;
    class IAction;
    class IControlDefinition;

    /// \brief 对话框接口类
    ///
    /// 用户可通过此对话框输入action执行过程需要的参数或者一些配置.
    /// 此对话框可以通过控件定义数组定制各种控件，目前支持Radio, CheckBox, LineEdit和 ComboBox.
    /// 对话框一般由ActionBase派生类负责创建、销毁.    
    class GCMP_ACTION_INTERFACE_EXPORT IActionInputDialog:public WeakReferenceable
    {
    public:
        /// \brief 析构函数
        virtual ~IActionInputDialog() {}

    public:
        /// \brief 通过控件定义的方式创建对话框
        ///
        /// \param title对话框标题
        /// \param controlDefinitions 控件定义数组
        /// \param pAction 创建此对话框的Action
        /// \return 对话框
        static OwnerPtr<IActionInputDialog> Create(const std::wstring& title, std::vector<OwnerPtr<IControlDefinition>>&& controlDefinitions, IAction* pAction); 

        /// \brief 获取对话框关联事件
        ///
        /// \return 对话框关联事件
        virtual IActionInputEvent* GetInputEvent() = 0;
    };
}
